/**  
 * @Title: ModuleValidator
 * @Package com.limit.control.admin.validate
 * @author maoyun(maoyun0903@163.com)
 * @date 2014-4-2 下午05:53:37
 * @version V1.0
 */ 
package com.limit.control.admin.validate;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;
import com.limit.model.Module;

/** 
 * <br/>
 * @author maoyun(maoyun0903@163.com)
 * @date 2014-4-2 下午05:53:37 
 * @version V1.0
 */

public class ModuleValidator extends Validator {

	/* 
	 * 
	 * @param c 
	 * @see com.jfinal.validate.Validator#validate(com.jfinal.core.Controller) 
	 */
	@Override
	protected void validate(Controller c) {
		this.validateRequired("module.pid", "pidError", "父权限ID不能为空！");
		this.validateRequired("module.name", "nameError", "权限名称不能为空！");
		this.validateRequired("module.url", "urlError", "URL不能为空！");
	}

	/* 
	 * 
	 * @param c 
	 * @see com.jfinal.validate.Validator#handleError(com.jfinal.core.Controller) 
	 */
	@Override
	protected void handleError(Controller c) {
		
		c.keepModel(Module.class);
		c.setAttr("plist", Module.dao.getListByPid(0));
		c.render("module_view.html");
		
		
	}

}
